#Autor: Verdi Vega Evelin
#Problema 11,capitulo 11: Correr un programa que facilite la obtencion del mlnimo comun denominador(mcd) de dos numeros.
#FileName: once.s

mcd(int, int):
        stmfd   sp!, {fp, lr}
        add     fp, sp, #4
        sub     sp, sp, #24
        str     r0, [fp, #-24]
        str     r1, [fp, #-28]
        mov     r3, #0
        str     r3, [fp, #-16]
        sub     r2, fp, #24
        sub     r3, fp, #28
        mov     r0, r2
        mov     r1, r3
        bl      int const& std::max<int>(int const&, int const&)
        mov     r3, r0
        ldr     r3, [r3, #0]
        str     r3, [fp, #-8]
        sub     r2, fp, #24
        sub     r3, fp, #28
        mov     r0, r2
        mov     r1, r3
        bl      int const& std::min<int>(int const&, int const&)
        mov     r3, r0
        ldr     r3, [r3, #0]
        str     r3, [fp, #-12]
.L2:
        ldr     r3, [fp, #-12]
        str     r3, [fp, #-16]
        ldr     r3, [fp, #-8]
        mov     r0, r3
        ldr     r1, [fp, #-12]
        bl      __aeabi_idivmod
        mov     r3, r1
        str     r3, [fp, #-12]
        ldr     r3, [fp, #-16]
        str     r3, [fp, #-8]
        ldr     r3, [fp, #-12]
        cmp     r3, #0
        moveq   r3, #0
        movne   r3, #1
        and     r3, r3, #255
        cmp     r3, #0
        bne     .L2
        ldr     r3, [fp, #-16]
        mov     r0, r3
        sub     sp, fp, #4
        ldmfd   sp!, {fp, pc}
mcm(int, int):
        stmfd   sp!, {fp, lr}
        add     fp, sp, #4
        sub     sp, sp, #24
        str     r0, [fp, #-24]
        str     r1, [fp, #-28]
        mov     r3, #0
        str     r3, [fp, #-8]
        sub     r2, fp, #24
        sub     r3, fp, #28
        mov     r0, r2
        mov     r1, r3
        bl      int const& std::max<int>(int const&, int const&)
        mov     r3, r0
        ldr     r3, [r3, #0]
        str     r3, [fp, #-12]
        sub     r2, fp, #24
        sub     r3, fp, #28
        mov     r0, r2
        mov     r1, r3
        bl      int const& std::min<int>(int const&, int const&)
        mov     r3, r0
        ldr     r3, [r3, #0]
        str     r3, [fp, #-16]
        ldr     r0, [fp, #-12]
        ldr     r1, [fp, #-16]
        bl      mcd(int, int)
        mov     r3, r0
        ldr     r0, [fp, #-12]
        mov     r1, r3
        bl      __aeabi_idiv
        mov     r3, r0
        ldr     r2, [fp, #-16]
        mul     r3, r2, r3
        str     r3, [fp, #-8]
        ldr     r3, [fp, #-8]
        mov     r0, r3
        sub     sp, fp, #4
        ldmfd   sp!, {fp, pc}
.LC0:
        .ascii  "Ingrese el primer numero: \012\000"
.LC1:
        .ascii  "Ingrese el segundo numero: \012\000"
.LC2:
        .ascii  "El M.C.M. entre \000"
.LC3:
        .ascii  " y \000"
.LC4:
        .ascii  " es: \000"
main:
        stmfd   sp!, {r4, fp, lr}
        add     fp, sp, #8
        sub     sp, sp, #12
        ldr     r0, .L5
        ldr     r1, .L5+4
        bl      std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)
        sub     r3, fp, #16
        ldr     r0, .L5+8
        mov     r1, r3
        bl      std::basic_istream<char, std::char_traits<char> >::operator>>(int&)
        ldr     r0, .L5
        ldr     r1, .L5+12
        bl      std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)
        sub     r3, fp, #20
        ldr     r0, .L5+8
        mov     r1, r3
        bl      std::basic_istream<char, std::char_traits<char> >::operator>>(int&)
        ldr     r0, .L5
        ldr     r1, .L5+16
        bl      std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)
        mov     r3, r0
        mov     r2, r3
        ldr     r3, [fp, #-16]
        mov     r0, r2
        mov     r1, r3
        bl      std::basic_ostream<char, std::char_traits<char> >::operator<<(int)
        mov     r3, r0
        mov     r0, r3
        ldr     r1, .L5+20
        bl      std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)
        mov     r3, r0
        mov     r2, r3
        ldr     r3, [fp, #-20]
        mov     r0, r2
        mov     r1, r3
        bl      std::basic_ostream<char, std::char_traits<char> >::operator<<(int)
        mov     r3, r0
        mov     r0, r3
        ldr     r1, .L5+24
        bl      std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)
        mov     r3, r0
        mov     r4, r3
        ldr     r2, [fp, #-16]
        ldr     r3, [fp, #-20]
        mov     r0, r2
        mov     r1, r3
        bl      mcm(int, int)
        mov     r3, r0
        mov     r0, r4
        mov     r1, r3
        bl      std::basic_ostream<char, std::char_traits<char> >::operator<<(int)
        mov     r3, #0
        mov     r0, r3
        sub     sp, fp, #8
        ldmfd   sp!, {r4, fp, pc}
.L5:
        .word   std::cout
        .word   .LC0
        .word   std::cin
        .word   .LC1
        .word   .LC2
        .word   .LC3
        .word   .LC4
int const& std::max<int>(int const&, int const&):
        str     fp, [sp, #-4]!
        add     fp, sp, #0
        sub     sp, sp, #12
        str     r0, [fp, #-8]
        str     r1, [fp, #-12]
        ldr     r3, [fp, #-8]
        ldr     r2, [r3, #0]
        ldr     r3, [fp, #-12]
        ldr     r3, [r3, #0]
        cmp     r2, r3
        bge     .L8
        ldr     r3, [fp, #-12]
        b       .L9
.L8:
        ldr     r3, [fp, #-8]
.L9:
        mov     r0, r3
        add     sp, fp, #0
        ldmfd   sp!, {fp}
        bx      lr
int const& std::min<int>(int const&, int const&):
        str     fp, [sp, #-4]!
        add     fp, sp, #0
        sub     sp, sp, #12
        str     r0, [fp, #-8]
        str     r1, [fp, #-12]
        ldr     r3, [fp, #-12]
        ldr     r2, [r3, #0]
        ldr     r3, [fp, #-8]
        ldr     r3, [r3, #0]
        cmp     r2, r3
        bge     .L11
        ldr     r3, [fp, #-12]
        b       .L12
.L11:
        ldr     r3, [fp, #-8]
.L12:
        mov     r0, r3
        add     sp, fp, #0
        ldmfd   sp!, {fp}
        bx      lr
__static_initialization_and_destruction_0(int, int):
        stmfd   sp!, {fp, lr}
        add     fp, sp, #4
        sub     sp, sp, #8
        str     r0, [fp, #-8]
        str     r1, [fp, #-12]
        ldr     r3, [fp, #-8]
        cmp     r3, #1
        bne     .L13
        ldr     r2, [fp, #-12]
        ldr     r3, .L15
        cmp     r2, r3
        bne     .L13
        ldr     r0, .L15+4
        bl      std::ios_base::Init::Init()
        ldr     r3, .L15+8
        ldr     r0, .L15+4
        mov     r1, r3
        ldr     r2, .L15+12
        bl      __aeabi_atexit
.L13:
        sub     sp, fp, #4
        ldmfd   sp!, {fp, pc}
.L15:
        .word   65535
        .word   std::__ioinit
        .word   std::ios_base::Init::~Init()
        .word   __dso_handle
global constructors keyed to mcd(int, int):
        stmfd   sp!, {fp, lr}
        add     fp, sp, #4
        mov     r0, #1
        ldr     r1, .L18
        bl      __static_initialization_and_destruction_0(int, int)
        ldmfd   sp!, {fp, pc}
.L18:
        .word   65535
